﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Text;
using System.Threading.Tasks;

namespace chapt1Example1
{
    class Program
    {
        static void Main(string[] args)
        {
            Uri baseAddress = new Uri("http://localhost:500");
            using (ServiceHost host = new ServiceHost(typeof(DemoService), baseAddress))
            {
                //添加终结点
                BasicHttpBinding binding = new BasicHttpBinding();
                host.AddServiceEndpoint(typeof(IDemo), binding, "demo");

                //打开服务
                host.Open();
                Console.WriteLine("WCF 服务已启动.");

                Console.Read();
                host.Close();   //关闭服务
            }
        }
    }
}
